var _util = _interopRequireDefault(require("../../../public/utils/util")), _api = _interopRequireDefault(require("../../../utils/api")), _apiCode = _interopRequireDefault(require("../../../public/utils/api-code"));

function _interopRequireDefault(t) {
    return t && t.__esModule ? t : {
        default: t
    };
}

Component({
    properties: {
        mode: {
            type: String,
            value: "view"
        },
        guid: String
    },
    data: {
        isShown: !1
    },
    methods: {
        toggle: function() {
            var e = this;
            this.data.authModalInfo || this.getAuthModalInfo().then(function(t) {
                t.time = _util.default.formatLocalDate(t.founddingtime, "Y年M月D日"), e.setData({
                    authModalInfo: t
                });
            });
            var t = this.data, i = t.mode, a = t.isShown;
            this.setData({
                isShown: !a
            }), "card" === i && wx[a ? "showTabBar" : "hideTabBar"]({
                animation: !0
            });
        },
        getAuthModalInfo: function() {
            return _api.default.minicard.auth.getauthinfo({
                data: {
                    guid: this.data.guid
                }
            }).then(function(t) {
                return t.code === _apiCode.default.SUCCESS ? Promise.resolve(t.data) : Promise.reject();
            });
        }
    }
});